This analysis looks at language usage on the internet over time and across regions within Ukraine. Google Trends data using the gtrendsR package is primarily used. The gtrendsR limits the amount of queries you can conduct and I have not been able to go over the cap.
This analysis somewhat relies on revealed preference theory in assuming that the language people use on the internet is the one that really prefer to use, but not actually express in public or other setting. This is partly inspired by the book by Seth Stephens-Davidowitz Everybody Lies who found people expressed things online that they likely wouldn’t openly express. Still, there are clear limitations with revealed preference theory in the context of internet usage in Ukraine. A clear limitation, especially going back further in time, is that there was a genuine dearth of Ukrainian language resources for many things. Even to this day it’s possible that primarily Ukrainian speakers could search in Russian for certain things where there are few Ukrainian language sources.
Below are intial queries of different words over time that are spelled differently in Russian v Ukrainian over time with ticks for key events and a trend line.
how <-time_plot(wide_dat(process_g_trends(readRDS("C:/UKR-RU-Language-Analysis/Trend Queries/how2010_01_01_2025_05_01.RDS"))[[1]]), "How: Як/как")
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
i Please use `linewidth` instead.
Reading layer `gadm41_UKR_1' from data source
`C:\UKR-RU-Language-Analysis\Shapefiles\gadm41_UKR_1.shp' using driver `ESRI Shapefile'
Simple feature collection with 28 features and 11 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 22.14045 ymin: 44.38597 xmax: 40.21807 ymax: 52.37503
Geodetic CRS: WGS 84
#standardize namesnam <-read.csv("C:/UKR-RU-Language-Analysis/Shapefiles/name_lookup.csv")#Make sure names matchregions_tab <-cbind(regions_tab,shapefile_name= nam$shapefile_name)map_data <- ukraine_sf %>%left_join(regions_tab, by =c("NAME_1"="shapefile_name"))#Kiev city fails join for some reason. Manually correcting and renmaingmap_data$rat[13] <- regions_tab$rat[12]map_data$NAME_1[13] <-"Kyiv City"breaks <-c(0, .1,.25, 0.5, 1, 2,4,10, Inf)labels <-c("<0.25", "0.25–0.5", "0.5–1", "1–2", ">2")tmap_mode("plot")
i tmap mode set to "plot".
tm_shape(map_data) +tm_polygons("rat", palette ="RdYlGn", style ="fixed",breaks = breaks,palette ="RdYlGn",title ="UA/RU Language Ratio",orientation ="landscape") +tm_layout(title ="Ukrainian-to-Russian Search Ratio by Oblast",legend.outside =TRUE)
-- tmap v3 code detected -------------------------------------------------------
[v3->v4] `tm_polygons()`: instead of `style = "fixed"`, use fill.scale =
`tm_scale_intervals()`.
i Migrate the argument(s) 'style', 'breaks', 'palette' (rename to 'values') to
'tm_scale_intervals(<HERE>)'[v3->v4] `tm_polygons()`: migrate the argument(s) related to the legend of the
visual variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'[tm_polygons()] Argument `orientation` unknown.[v3->v4] `tm_layout()`: use `tm_title()` instead of `tm_layout(title = )`[cols4all] color palettes: use palettes from the R package cols4all. Run
`cols4all::c4a_gui()` to explore them. The old palette name "RdYlGn" is named
"brewer.rd_yl_gn"Multiple palettes called "rd_yl_gn" found: "brewer.rd_yl_gn", "matplotlib.rd_yl_gn". The first one, "brewer.rd_yl_gn", is returned.
tmap_mode("view") # Enables interactive mode
i tmap mode set to "view".
tm_shape(map_data) +tm_polygons("rat", palette ="RdYlGn", style ="fixed",breaks = breaks,title ="UA/RU Language Ratio", popup.vars =c("Oblast"="NAME_1", "Ratio"="rat")) +tm_layout(title ="Interactive Ukrainian-to-Russian Search Ratio Map")
-- tmap v3 code detected -------------------------------------------------------
[v3->v4] `tm_polygons()`: instead of `style = "fixed"`, use fill.scale =
`tm_scale_intervals()`.
i Migrate the argument(s) 'style', 'breaks', 'palette' (rename to 'values') to
'tm_scale_intervals(<HERE>)'[v3->v4] `tm_polygons()`: migrate the argument(s) related to the legend of the
visual variable `fill` namely 'title' to 'fill.legend = tm_legend(<HERE>)'[v3->v4] `tm_layout()`: use `tm_title()` instead of `tm_layout(title = )`[cols4all] color palettes: use palettes from the R package cols4all. Run
`cols4all::c4a_gui()` to explore them. The old palette name "RdYlGn" is named
"brewer.rd_yl_gn"Multiple palettes called "rd_yl_gn" found: "brewer.rd_yl_gn", "matplotlib.rd_yl_gn". The first one, "brewer.rd_yl_gn", is returned.
The echo: false option disables the printing of code (only output is displayed).